﻿@model mvcForum.Web.ViewModels.MessageViewModel
@using mvcForum.Core;
@using mvcForum.Web.Extensions;
@using mvcForum.Web.Helpers;
@{
	Boolean deleted = (Model.Flag & PostFlag.Deleted) != 0;
	Boolean quarantined = (Model.Flag & PostFlag.Quarantined) != 0;
}
		<tr>
@if (deleted) {
			<td></td>
			<td><h4>Deleted</h4>@Model.DeleteReason</td>
}
else {
			<td>@Html.Partial("MessagePosterPartial", Model)</td>
			<td>
				<div class="row">
					<div class="col-md-9">
	@if (Model.LastRead) {
				<a name="sincelast"></a>
	}
	@if (quarantined) {
						<h3>Quarantined</h3>
	}
	else if (Model.Position == 0) {
						<h3>@Model.Subject</h3>
	}
	else {
						<h4>@Model.Subject</h4>
	}
					</div>
					<div class="col-md-3">
						<p class="text-right muted">@Model.Posted.ToLocalDateTime().ToString("F")</p>
					</div>
				</div>
	@if (!quarantined) {
				<hr />
				<div class="row">
					<div class="col-md-12">
						@ForumHelper.ParseContent(Model.Body)
					</div>
				</div>
		if (Model.Attachments.Count() > 0) {
				<div class="row">
					<div class="col-md-12">
						<h6>@ForumHelper.GetString("ViewMessage.Attachments")</h6>
						<ul class="list-unstyled">
			@foreach (var att in Model.Attachments) {
							@Html.Partial("AttachmentPartial", att)
			}
						</ul>
					</div>
				</div>
		}		<hr />
				<div class="row">
					<div class="col-md-6 muted">
		@if (Model.LastEdited.HasValue) {
				@ForumHelper.GetString("ViewMessage.Edited", new { Editor = (Model.ModeratorChanged ? ForumHelper.GetString("Moderator") : Model.PrettyName), Timestamp = Model.LastEdited.Value })
		}
					</div>
					<div class="col-md-6">
						@Html.Partial("PostActions", Model)
					</div>
				</div>
		
 }
			</td>
 }
		</tr>
